<?php
  include('../config.php');

  $username = $_GET['username'];
  $password = $_GET['password'];

  $sql = "select * from users where username='$username' and password='$password'";

  //$res是一个资源类型的数据
  $res = mysql_query($sql);

  //获取$res的条数
  $num = mysql_num_rows($res);
  if ($num > 0) {
    echo json_encode(array(
      "code" => 200,
      "body" => array(
          "username" => $username,
          "password" => $password
      )
    ));
  } else {
    echo json_encode(array(
      "code" => 201,
      "body" => array(
        "massage" => "账号或密码错误"
      )
    ));
  }

?>